<include file="Public/head" />
<link type="text/css" rel="stylesheet" href="{:get_style_cdnurl()}paimai/yunying/css/cashier.css" />
<style>
    table {font-size: 14px;}
    table input {  width: 65px;  height: 20px;  text-align: inherit;  color: black;  }
</style>
</head>
<include file="Public/common_header" />
<div class="mian">
    <include file="Public/sidebar" menu="cwgl.skd"/>
    <div class="mianR">
        <table class="receivables-cont">
            <tbody>
            <tr>
                <td>收款单号</td>
                <td>{$info.collection_no}</td>
                <td>收款类型</td>
                <td><?php echo $collection_type_list[$info['payment_type']];?></td>
                <td>收款单创建时间</td>
                <td>{$info.create_time}</td>
            </tr>
            <tr>
                <td>车辆编号</td>
                <td>{$info.car_source_nu}</td>
                <td>收款单状态</td>
                <td>{$info.status_cn}</td>
                <td>收款完成时间</td>
                <td>{$info.update_time}</td>
            </tr>
            <tr>
                <td>拍单号</td>
                <td>{$info.order_no}</td>
                <td>收款金额</td>
                <td>{$info.amount} 元</td>
            </tr>
            <tr>
                <td>变更单号</td>
                <td>{$info.change_no}</td>
                <td>收款人</td>
                <td>{$info.emp_name}</td>
            </tr>
            </tbody>
        </table>
        <div>
        <h3 class="yonghu">收款明细</h3>
        <table class="receivables-cont" style="width: 50%; margin-top:0;float: left; margin-right: 10px;">
            <tbody>
            <tr>
                <td>收款金额</td>
                <td>{$info.amount}</td>
            </tr>
            <?php if($info['payment_type']==1 || $info['payment_type']==3):?>
              <tr>
                <td>手续费</td>
                <?php if($info['status']==0):?>
                <td><input id="poundage" type="text" value="" /></td>
                <?php else:?>
                <td>{$info.poundage}</td>
                <?php endif;?>
              </tr>
            <?php endif;?>
            </tbody>
        </table>

        <?php if(in_array($info['payment_type'],$status_group['ORDER'])):?>
            <table class="receivables-cont" style="width: 47%;margin-top:0;float: right;">
                <tbody>
                <tr>
                    <td></td>
                    <td>车款</td>
                    <td>{$fee.success_price}</td>
                </tr>
                <tr>
                    <td>-</td>
                    <td>抽奖立减</td>
                    <td>{$fee.lottery}</td>
                </tr>
                <tr>
                    <td>-</td>
                    <td>线下活动减免</td>
                    <td>{$fee.activity_reduction}</td>
                </tr>
                <tr>
                    <td>-</td>
                    <td>代金券</td>
                    <td>{$fee.coupon}</td>
                </tr>
                <tr>
                    <td>+</td>
                    <td>交易服务费</td>
                    <td>{$fee.commision}</td>
                </tr>
                <tr>
                    <td>+</td>
                    <td>交付服务费</td>
                    <td>{$fee.transfer_fee}</td>
                </tr>
                <tr>
                    <td>=</td>
                    <td>车商应收</td>
                    <td>{$fee.final_price}</td>
                </tr>

                </tbody>
            </table>
        <?php endif;?>
        </div>
        <div class="clear"></div>
        <!--<table class="receivables-cont" style="width:400px;">-->
            <!--<thead>-->
            <!--<tr>-->
                <!--<th>应收</th>-->
                <!--<th>实收</th>-->
                <!--<th>未收</th>-->
            <!--</tr>-->
            <!--</thead>-->
            <!--<tbody>-->
            <!--<tr>-->
                <!--<td>{$fee.final_price}</td>-->
                <!--<td>{$info.amount}</td>-->
                <!--<td>{$fee['final_price'] - $info['amount'] }</td>-->
            <!--</tr>-->
            <!--</tbody>-->
        <!--</table>-->
        <div class="yongBtn">
            <?php if($info['status']==0):?>
            <input type="button" class="quxiao" id="confirmCollect" value="确认收款">
            <?php endif;?>
            <input type="button" class="quxiao" onclick="window.close()" value="关闭">
        </div>
        <div class="clear"></div>
    </div>
</div>
</body>
<script type="text/javascript">

    $("#confirmCollect").click(function () {
        var poundage = $("#poundage").val()
        if(typeof(poundage)=='undefined'){
            _confirmPost()
        }else {
            poundage = Number(poundage)
            if( /^-?\d+\.?\d{0,2}$/.test(poundage) == false){
                shibai_alert1("所填写金额不得超过小数点后两位",1000)
                return
            }
            confirm_alert1("您确认手续费为 <span style='color: #ff0000;'>"+poundage+"</span> 元", _confirmPost)
        }
    });
    
    function _confirmPost() {
        $(".yunBei").css("display",'block');
        var poundage = $("#poundage").val()
        var postData = {
            'cid':"<?php echo $info['id'];?>",
            'poundage':poundage
        }
        $.post("/Collection/confirm",postData,function (data) {
            if(data.code!=200){
                shibai_alert(data.msg,1000,function () {
                    window.location.reload()
                    return false
                })
            }else {
                btn_alert("确认成功",1000,function () {
                    window.opener.location.reload()
                    window.close()
                })
            }
        },'json');
    }
</script>
<include file="Public/foot" />